package com.a3dweijing.wetouch2.constant;

import com.a3dweijing.wetouch2.Activity.BuyActivity;
import com.a3dweijing.wetouch2.Activity.GoodsOrOrderItem;
import com.a3dweijing.wetouch2.bean.CardListMsg;
import com.a3dweijing.wetouch2.bean.ConnetionDate;
import com.a3dweijing.wetouch2.bean.EvaluatedDate;
import com.a3dweijing.wetouch2.bean.Goodlistitem;
import com.a3dweijing.wetouch2.bean.MarketDate;
import com.a3dweijing.wetouch2.bean.PendingPaymentMsg;
import com.a3dweijing.wetouch2.bean.ReferralcodeDate;
import com.a3dweijing.wetouch2.bean.ResultMsg;
import com.a3dweijing.wetouch2.bean.ShoppingCartItem;
import com.a3dweijing.wetouch2.bean.ShoppingDetails;
import com.a3dweijing.wetouch2.bean.User;
import com.google.gson.JsonObject;

import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Map;
import java.util.Observable;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.HeaderMap;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;

/**
 * Created by Administrator on 2018/3/21.
 */

public interface Api
{
    @FormUrlEncoded
    @POST("user/login")
    Call<ResponseBody> get(@Field("user_telnum") String name, @Field("user_password") String paw);
    
    /**
     * 更新头像
     *
     * @param file
     * @param f
     * @param s
     * @return
     */
    @Multipart
    @POST("user/updateHead")
    Call<JsonObject> updatehead(@Part MultipartBody.Part file, @Part MultipartBody.Part f, @Part MultipartBody.Part s);
    
    /**
     * 首页
     * 
     * @return
     */
    @GET("admin.php/api/shopping/homepage")
    Call<JsonObject> shoppingHome();
    
    /**
     * @return
     */
    @FormUrlEncoded
    @POST("admin.php/api/shopping/goodsInfo")
    io.reactivex.Observable<ShoppingDetails> shoppingDetails(@Field("goods_id") int id,
        @Field("user_id") String user_id);
    
    /**
     * @return
     */
    @FormUrlEncoded
    @POST("admin.php/api/shopping/homeClass")
    io.reactivex.Observable<Goodlistitem> goodsListviewDate(@Field("genre") int dors, @Field("class_id") int classId,
        @Field("goods_id") String goodsId);
    
    @FormUrlEncoded
    @POST("admin.php/api/shopping/allGoods")
    io.reactivex.Observable<Goodlistitem> getListViewAllDate(@Field("genre") int dors,
        @Field("goods_id") String goodsId);
    
    /**
     * 加入购物车
     * 
     * @return
     */
    @FormUrlEncoded
    @POST("admin.php/api/shopping/addShoppingCart")
    io.reactivex.Observable<ResultMsg> addShoppingCart(@Field("goods_id") int goodsId, @Field("user_id") int userId,
        @Field("goods_number") String goodsNumber, @Field("s_price") String sPrice,
        @Field("goods_name") String goodsName, @Field("genre") String genre);
    
    /**
     * 加入购物车
     *
     * @return
     */
    @FormUrlEncoded
    @POST("admin.php/api/shopping/shoppingCarlist")
    io.reactivex.Observable<ShoppingCartItem> shoppingCartlist(@Field("user_id") int userId);
    
    @POST("admin.php/api/Wxpay/createOrder")
    Call<JsonObject> buysnge(@Body RequestBody info);
    
    @POST("admin.php/api/Wxpay/getWxpay")
    Call<JsonObject> buysnge(@Field("order_code") int order_code, @Field("localIp") String localIp);
    
    @FormUrlEncoded
    @POST("admin.php/api/Wxpay/createMember")
    Call<JsonObject> buyVip(@Field("user_id") String user_id, @Field("order_total") String order_total,
        @Field("localIp") String localIp);
    
    @FormUrlEncoded
    @POST("admin.php/api/shopping/increase")
    Call<JsonObject> addOrJian(@Field("goods_id") int goods_id, @Field("genre") int genre);
    
    @FormUrlEncoded
    @POST("admin.php/api/shopping/deleteShopping")
    Call<JsonObject> delete(@Field("goods_id") String id);
    
    @FormUrlEncoded
    @POST("admin.php/api/shopping/confirmOrder")
    io.reactivex.Observable<BuyActivity.Msg> defulweizhi(@Field("user_id") String id);
    
    @FormUrlEncoded
    @POST("admin.php/api/index/pendingPayment")
    io.reactivex.Observable<PendingPaymentMsg> getOrder(@Field("user_id") int id, @Field("genre") int genre);
    
    @FormUrlEncoded
    @POST("admin.php/api/index/evaluateGoods")
    io.reactivex.Observable<EvaluatedDate> getEvaluate(@Field("user_id") int id);
    
    /**
     * 评价
     *
     * @param id
     * @param user_id
     * @param comment_style
     * @return
     */
    @FormUrlEncoded
    @POST("admin.php/api/index/comment")
    io.reactivex.Observable<ResultMsg> evaluate(@Field("goods_comment_info") String content,
        @Field("goods_id") int goods_id, @Field("user_id") int user_id, @Field("comment_style") int comment_style,
        @Field("order_id") int order_id);
    
    @FormUrlEncoded
    @POST("admin.php/api/index/orderList")
    io.reactivex.Observable<GoodsOrOrderItem> getordergoods(@Field("order_id") int id);
    
    @FormUrlEncoded
    @POST("admin.php/api/index/queryMarket")
    io.reactivex.Observable<MarketDate> queryMarket(@Field("order_id") int id);
    
    @FormUrlEncoded
    @POST("admin.php/api/index/cancelOrder")
    io.reactivex.Observable<ResultMsg> cancelOrder(@Field("order_id") int id);
    
    @FormUrlEncoded
    @POST("admin.php/api/index/goodsReceipt")
    io.reactivex.Observable<ResultMsg> receiptGood(@Field("order_id") int id);
    
    /**
     * 得到用户收藏列表
     * 
     * @param id
     * @return
     */
    @FormUrlEncoded
    @POST("admin.php/api/index/collectionList")
    io.reactivex.Observable<ConnetionDate> getPrivteList(@Field("user_id") int id);
    
    @FormUrlEncoded
    @POST("admin.php/api/index/collection")
    io.reactivex.Observable<ResultMsg> collection(@Field("user_id") int user_id, @Field("goods_id") int goods_id,
        @Field("genre") int genre);
    
    @FormUrlEncoded
    @POST("admin.php/api/index/applyRefund")
    io.reactivex.Observable<ResultMsg> refund(@Field("user_id") int user_id, @Field("order_id") int order_id,
        @Field("refund_reason") String refund_reason);
    
    @FormUrlEncoded
    @POST("admin.php/api/user_info/updateName")
    io.reactivex.Observable<ResultMsg> editUsername(@Field("user_id") int user_id,
        @Field("user_name") String user_name);
    
    // @Multipart
    // @POST("admin.php/api/UserInfo/healthConsultant")
    // io.reactivex.Observable<ResultMsg> healthConsultant(@Field("user_id") String user_id, @Field("name") String name,
    // @Field("age_limit") String age_limit, @Field("certificate_code") String certificate_code,
    // @Field("aptitude_code") String aptitude_code, @Field("identity_card") String identity_card,
    // @Field("apply_type") int apply_type, @Field("positive_img") int positive_img, @Field("back_img") int back_img);
    
    @Multipart
    @POST("admin.php/api/user_info/healthConsultant")
    io.reactivex.Observable<ResultMsg> healthConsultant(@PartMap Map<String, RequestBody> usermaps,
        @Part MultipartBody.Part positive_img, @Part MultipartBody.Part back_img);
    
    @FormUrlEncoded
    @POST("admin.php/api/user_info/referralist")
    io.reactivex.Observable<ReferralcodeDate> getReferalist(@Field("user_id") int user_id);
    
    @FormUrlEncoded
    @POST("admin.php/api/user_info/verificationCode")
    io.reactivex.Observable<ResultMsg> getverificationCode(@Field("mobile") String code);
    
    @FormUrlEncoded
    @POST("admin.php/api/user_info/bankcardList")
    io.reactivex.Observable<CardListMsg> getBanklist(@Field("user_id") int user_id);
    
    @FormUrlEncoded
    @POST("admin.php/api/user_info/bankCard")
    io.reactivex.Observable<ResultMsg> bankCard(@Field("mobile") String mobile, @Field("bankcard") String bankcard,
        @Field("cardNo") String cardNo, @Field("realName") String realName, @Field("user_id") String user_id,
        @Field("code") String code);
}
